import { createRouter, createWebHistory } from 'vue-router'

// 导入视图组件
import HomeView from '@/views/HomeView.vue'
import CreateInvestmentView from '@/views/CreateInvestmentView.vue'
import EditInvestmentView from '@/views/EditInvestmentView.vue'
import InvestmentDetailView from '@/views/InvestmentDetailView.vue'
import VerificationView from '@/views/VerificationView.vue'
import HistoryView from '@/views/HistoryView.vue'
import EventsView from '@/views/EventsView.vue'

// 定义路由
const routes = [
  {
    path: '/',
    name: 'home',
    component: HomeView
  },
  {
    path: '/create',
    name: 'create',
    component: CreateInvestmentView
  },
  {
    path: '/edit/:id',
    name: 'edit',
    component: EditInvestmentView,
    props: true
  },
  {
    path: '/detail/:id',
    name: 'detail',
    component: InvestmentDetailView,
    props: true
  },
  {
    path: '/verification',
    name: 'verification',
    component: VerificationView
  },
  {
    path: '/history',
    redirect: '/'
  },
  {
    path: '/history/:dataHash',
    name: 'history',
    component: HistoryView,
    props: true
  },
  {
    path: '/events',
    name: 'events',
    component: EventsView
  }
]

// 创建路由实例
const router = createRouter({
  history: createWebHistory(process.env.BASE_URL),
  routes
})

export default router 